function isValid(type) {
    var username = "username-" + type, password = "password-" + type;
    username = document.getElementById(username).value;
    password = document.getElementById(password).value;
    if (isEmpty(username) || isEmpty(password)) {
        alert("用户名或密码为空！")
        return false;
    }
    return true;

}

function isEmpty(str) {
    return !str || str.trim().length === 0;
}
